﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RMS.Model
{
    public class ResearchActivity
    {
        private int _activityId;
        private string _activityName;
        private string _activityDescription;
        private int _number;
        private Budget _budget;

        public ResearchActivity(int id, int number, string name, string description = "...")
        {
            this._activityId = id;
            this._number = number;
            this._activityName = name;
            this._activityDescription = description;
            this._budget = new Budget(0);
        }

        public int Id
        {
            get { return this._activityId; }
            set { this._activityId = value; }
        }
        public string Name
        {
            get { return this._activityName; }
            set { this._activityName = value; }
        }
        public string Description
        {
            get { return this._activityDescription; }
            set { this._activityDescription = value; }
        }
        public int Order
        {
            get { return this._number; }
            set { this._number = value; }
        }
        public Budget Budget
        {
            get { return this._budget; }
            set { this._budget = value; }
        }
    }

    public class ResearchTeamMember
    {
        private int _memberId;
        private string _memberName;
        private int _hoursCount;

        public ResearchTeamMember(int id, string name, int hours)
        {
            this._memberId = id;
            this._memberName = name;
            this._hoursCount = hours;
        }

        public int Id
        {
            get { return this._memberId; }
            set { this._memberId = value; }
        }
        public string Name
        {
            get { return this._memberName; }
            set { this._memberName = value; }
        }
        public int HoursCount
        {
            get { return this._hoursCount; }
            set { this._hoursCount = value; }
        }
    }

    public class ResearchTeam
    {
        private int _teamId;
        private string _teamName;
        private string _teamDescription;
        private List<ResearchTeamMember> _members;

        public ResearchTeam(int id, string name, string description = "...")
        {
            this._teamId = id;
            this._teamName = name;
            this._teamDescription = description;
            this._members = new List<ResearchTeamMember>();
        }
        public int Id
        {
            get { return this._teamId; }
            set { this._teamId = value; }
        }
        public string Name
        {
            get { return this._teamName; }
            set { this._teamName = value; }
        }
        public string Description
        {
            get { return this._teamDescription; }
            set { this._teamDescription = value; }
        }
        public List<ResearchTeamMember> Members
        {
            get { return this._members; }
            set { this._members = value; }
        }
    }

    public class ResearchPhase
    {
        private int _phaseId;
        private string _phaseName;
        private string _phaseDescription;
        private SortedList<int, ResearchActivity> _activities;

        public ResearchPhase(int id, string name, string description = "...")
        {
            this._phaseId = id;
            this._phaseName = name;
            this._phaseDescription = description;
            this._activities = new SortedList<int, ResearchActivity>();
        }

        public int Id
        {
            get { return this._phaseId; }
            set { this._phaseId = value; }
        }
        public string Name
        {
            get { return this._phaseName; }
            set { this._phaseName = value; }
        }
        public string Description
        {
            get { return this._phaseDescription; }
            set { this._phaseDescription = value; }
        }
        public SortedList<int, ResearchActivity> Activities
        {
            get { return this._activities; }
            set { this._activities = value; }
        }
    }

    public class ResearchProject
    {
        private int _projectId;
        private string _projectName;
        private string _projectDescription;
        private ResearchTeam _team;
        private List<ResearchPhase> _phases;

        public ResearchProject(int id, string name, string description = "...")
        {
            this._projectId = id;
            this._projectName = name;
            this._projectDescription = description;
            this._team = null;
            this._phases = new List<ResearchPhase>();
        }

        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            ResearchProject project = obj as ResearchProject;
            if (project.Id == this.Id) return true;
            return false;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public int Id
        {
            get { return this._projectId; }
            set { this._projectId = value; }
        }
        public string Name
        {
            get { return this._projectName; }
            set { this._projectName = value; }
        }
        public string Description
        {
            get { return this._projectDescription; }
            set { this._projectDescription = value; }
        }
        public ResearchTeam Team
        {
            get { return this._team; }
            set { this._team = value; }
        }
        public List<ResearchPhase> Phases
        {
            get { return this._phases; }
            set { this._phases = value; }
        }
    }
}
